﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace InterfaceWinForm
{
    public partial class DataBindingBasics : Form
    {
        public DataBindingBasics()
        {
            InitializeComponent();
            List<Product> products = new List<Product>();
            products.Add(new Product(567, "Bicycle", 5,0));
            products.Add(new Product(456, "Car", 5000,567));
            products.Add(new Product(789, "Bike", 1500,567));
            radTreeView1.DataSource = products;
            radTreeView1.DisplayMember = "Description";
            radTreeView1.ValueMember = "ID";
            radTreeView1.ParentIDMember = "ParentId"; ;

        }

        public class Product
        {
            private int _id;
            private string _description;
            private float _price;
            private int _parentId;

            public int ParentId
            {
                get { return _parentId; }
                set { _parentId = value; }
            }

            public int ID
            {
                get { return _id; }
                set { _id = value; }
            }

            public string Description
            {
                get { return _description; }
                set { _description = value; }
            }

            public float Price
            {
                get { return _price; }
                set { _price = value; }
            }

            public Product(int id, string description, float price, int parentid )
            {
                _id = id;
                _description = description;
                _price = price;
                _parentId = parentid;
            }
        }
    }
}